import java.sql.SQLOutput;
import java.util.Scanner;

/**
 * 2024.2.1 第四课  逻辑控制+方法
 */
public class Test {
    //方法的重载
    //1.方法名 必须相同
    //2.参数列表不同【个数，类型，顺序】
    //3.返回值 不影响重载
    public static int add(int a,int b){
        return a+b;
    }
    public static int add(int a,int b,int c){
        return a+b;
    }
    public static double add(double a,double b){
        return a+b;
    }
    public static void main14(String[] args) {
        System.out.println( add(1,2));
        System.out.println(add(1.7,1.5));
        System.out.println(add(1,2,4));
       /* int x = 10;
        int y = 20;
        int ret = add(x,y);
        System.out.println(ret);
        double d1 = 12.3;
        double d2 = 34.5;
        add(d1,d2);*/
    }

    public static int fac(int n){
        int ret = 1;
        for(int i = 1; i <= n; i++){
            ret *= i;
        }
        return ret;
    }
    public static int facSum(int k){
        int sum = 0;
        for(int i = 1; i <= k; i++){
            sum +=fac(i);
        }
        return sum;
    }
    public static void main13(String[] args) {
        System.out.println(facSum(3));
        System.out.println(facSum(5));
    }

    public static int sum(int a,int b){
        return a+b;
    }
    public static void main12(String[] args) {
        int x = 10;
        int y = 20;
        int ret = sum(x,y);
        System.out.println(ret);
    }
    public static boolean Year(int year){
        if((0 == year % 4 && 0 != year % 100) || 0 == year % 400){
            return true;
        }else{
            return false;
        }
    }
    public static void main11(String[] args) {
        //获取一个数二进制序列中所有的偶数位和奇数位 ，分别输出二进制序列
        int n = 7;
        for(int i = 31;i >= 0;i -= 2){
            System.out.print(((n>>>1)& 1)+" ");
        }
        System.out.println();
        for(int i = 30;i >= 0;i -= 2){
            System.out.print(((n>>>1)& 1)+" ");
        }
    }
    public static void main10(String[] args) {
        //二进制中1的个数
        int n = 15;
        int count = 0;
        while(n != 0){
            count++;
            n = n &(n - 1);
        }
        System.out.println(count);
    }
    public static void main9(String[] args) {
        //水仙花数 153=1^3+5^3+3^3
        for(int i = 0; i < 999999; i++){
            int count = 0;//计算当前i 有几位数
            int tmp = i;
            while(tmp != 0){
                count++;
                tmp =tmp / 10;
            }
            //count的值 是多少已经完成计算 i还是没有变的
            //计算i[tmp]的每一位
            tmp = i;
            int sum = 0;
            while(tmp != 0){
                sum += Math.pow(tmp %10,3);
                tmp /= 10;
            }
            if(sum == i){
                System.out.println(i);
            }
        }
    }
    public static void main8(String[] args) {
        Scanner in = new Scanner(System.in);//九九乘法表
        int n =in.nextInt();
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= i; j++){
                System.out.print(j+"*"+i+"="+j*i+" ");
            }
            System.out.println();
        }
    }
    public static void main7(String[] args) {
        Scanner in = new Scanner(System.in);
        int count = 3;
        while(count != 0){
            System.out.println("请输入你的密码，你还有"+ count +"次机会!");
            String password = in.nextLine();
            if(password.equals("1234")){
                System.out.println("登入成功！");
                break;
            }else{
                System.out.println("密码错误！");
                count--;
            }
        }
    }
    public static void main6(String[] args) {
        //计算1/-1-1/2+1/3-1/4+1/5……+1/99-1/100的值
        double sum = 0;
        int flg = 1;
        for(int i = 1 ; i <= 100; i++){
            sum =sum =1.0 / i * flg;
            flg = -flg;
        }
        System.out.println(sum);
    }
    public static void main5(String[] args) {
        int a = 24;
        int b = 6;
        int c = a % b;
        while (c != 0){
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int k = 1; k < n; k++) {
            int i = 2;
            for (; i <= Math.sqrt(k); i++) {
                if (k % i == 0) {
                    break;
                }
            }
            if (i == Math.sqrt(k)) {
                System.out.println(k+"是素数！");
            }
        }
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int k = 1; k < n; k++) {
            int i = 2;
            for (; i < k/2; i++) {
                if (k % i == 0) {
                    break;
                }
            }
            if (i == k/2) {
                System.out.println(k+"是素数！");
            }
        }
    }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int k = 1; k < n; k++) {
            int i = 2;
            for (; i < k; i++) {
                if (k % i == 0) {
                    System.out.println(i+"不是素数！");
                    break;
                }
            }
            if (i == k) {
                System.out.println(k+"是素数！");
            }
        }
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n =scanner.nextInt();
        int count = 0;
        for(int i = 1;i <= n;i++){
            if(i / 10 == 9){
                count++;
            }else if(i % 10 == 9){
                count++;
            }
        }
        System.out.println(count);
    }
}